

<template>
  
  <!-- 鼠标改手 style="cursor: pointer;"  -->
  <input type="button" v-for="(item,index) in tabList"
        :key="index"
        鼠标改手
        style="cursor: pointer;" 
        @click="changeView(index)" 
        :value="item" >
        <KeepAlive >
          <component :is="currentView" ></component>
        </KeepAlive>
          
        
  
</template>
<script>
import Login from './components/Login.vue'
import Pc from './components/Pc.vue'
import Index from './components/Index.vue'

export default {
  name: 'HelloWorld',
  components: {
    Login,
    Pc,
    Index
  },
  data() {
    return {
      index: 0,
      arr: ['Pc', 'Login', 'Index'],
      tabList:['P','L','I']
    }

  },computed:{
    currentView(){
      return this.arr[this.index]
    }
  },methods:{
    changeView(index){
      this.index=index
    },
    
  },activated(){
    alert('1')
  },deactivated(){
    alert('2 ')
  }
}
</script>
<style scoped></style>
